package com.hhkj.api.sale.service.biz.impl;

import cn.hutool.core.bean.BeanUtil;
import com.hhkj.admin.sale.domain.SaleAccount;
import com.hhkj.admin.sale.service.base.SaleAccountService;
import com.hhkj.api.sale.common.session.holder.ApiSaleSessionHolder;
import com.hhkj.api.sale.model.res.ApiSaleAccountRes;
import com.hhkj.api.sale.service.biz.ApiSaleAccountBizService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * ApiSaleAccountBizServiceImpl
 *
 * @author HHKJ-SERVER-ZJ
 * @since 2023/10/26 15:13
 */
@Service
public class ApiSaleAccountBizServiceImpl implements ApiSaleAccountBizService {

    @Autowired
    private SaleAccountService saleAccountService;

    @Override
    public ApiSaleAccountRes get() {
        // 1、获取当前商家用户的余额信息
        Long saleId = ApiSaleSessionHolder.getSaleId();
        SaleAccount accountPo = saleAccountService.getBySaleId(saleId);
        return BeanUtil.toBean(accountPo, ApiSaleAccountRes.class);
    }
}
